From: Julian Sparber Date: Thu, 9 May 2024 15:36:34 +0000 (+0200) Subject: messageList: Reduce flexibility of section visibility X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~173^2^2~9 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=88f551d0a8a29354900718d540c13c3ca2577987;p=gnome-shell.git messageList: Reduce flexibility of section visibility Section visibility has become less complex when moving events out of the message list. We no longer need different behavior in different sections, so we can instead control the visibility of the entire list in a single place. Part-of: --- diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 9451d0afc..855343165 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -5,7 +5,6 @@ import GObject from 'gi://GObject'; import Shell from 'gi://Shell'; import St from 'gi://St'; -import * as Main from './main.js'; import * as MessageList from './messageList.js'; import * as PopupMenu from './popupMenu.js'; import {ensureActorVisibleInScrollView} from '../misc/animationUtils.js'; @@ -881,8 +880,6 @@ class CalendarMessageList extends St.Widget { this._notificationSection = new MessageList.NotificationSection(); this._addSection(this._notificationSection); - - Main.sessionMode.connect('updated', this._sync.bind(this)); } _addSection(section) { @@ -899,10 +896,6 @@ class CalendarMessageList extends St.Widget { _sync() { let sections = this._sectionList.get_children(); - let visible = sections.some(s => s.allowed); - this.visible = visible; - if (!visible) - return; let empty = sections.every(s => s.empty || !s.visible); this._placeholder.visible = empty; diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 103c4d439..92fff5ecb 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -1000,5 +1000,7 @@ class DateMenuButton extends PanelMenu.Button { // but the corresponding app (clocks, weather); however we can consider // that display-specific settings, so re-use "allowSettings" here ... this._displaysSection.visible = Main.sessionMode.allowSettings; + + this._messageList.visible = Main.sessionMode.hasNotifications && !Main.sessionMode.isGreeter; } }); diff --git a/js/ui/messageList.js b/js/ui/messageList.js index b9456f3f9..cf19648d1 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -862,10 +862,6 @@ export const MessageListSection = GObject.registerClass({ this.emit('message-focused', messageActor); } - get allowed() { - return true; - } - addMessage(message, animate) { this.addMessageAtIndex(message, -1, animate); } @@ -990,10 +986,6 @@ export const MessageListSection = GObject.registerClass({ } } - _shouldShow() { - return !this.empty; - } - _sync() { let messages = this._messages; let empty = messages.length === 0; @@ -1009,7 +1001,7 @@ export const MessageListSection = GObject.registerClass({ this.notify('can-clear'); } - this.visible = this.allowed && this._shouldShow(); + this.visible = !this.empty; } }); @@ -1026,11 +1018,6 @@ class NotificationSection extends MessageListSection { }); } - get allowed() { - return Main.sessionMode.hasNotifications && - !Main.sessionMode.isGreeter; - } - _sourceAdded(tray, source) { source.connectObject( 'notification-added', this._onNotificationAdded.bind(this), @@ -1111,8 +1098,4 @@ class MediaSection extends MessageListSection { this._players.delete(player); } - - get allowed() { - return !Main.sessionMode.isGreeter; - } });